package model;

import java.util.List;

import common.GridCoordinate;

/**
 * @author Colin
 *This class adds the damage that weapons do on zombosaurs,
 *the speed that the ammo moves, and an integer representing
 *the range of the weapon. Position can also be specified
 *in this class.
 */
public abstract class Weapon extends PlayableItem{
	
	private int damage;
	private int speed;
	private int rangeInt;
	private List<GridCoordinate> range;
	private String ammoImageName;
	
	//Weapon without position
	public Weapon( String name, String imageName, String ammoImageName, int cost, int damage, int speed, int rangeInt){
		super(name, imageName, cost);
		this.damage = damage;
		this.speed = speed;
		this.rangeInt = rangeInt;
		this.ammoImageName = ammoImageName;
	}
	
	//Weapon with position
	public Weapon( String name, String imageName, String ammoImageName, int cost, GridCoordinate position, int damage, int speed, int rangeInt ){
		super( name, imageName, cost, position);
		
		this.damage = damage;	
		this.speed = speed;
		this.rangeInt = rangeInt;
		this.ammoImageName = ammoImageName;
	}
	
	public int getDamage(){
		return this.damage;
	}
	
	public void setDamage( int d ){
		damage = d;
	}
	
	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}
	
	public int getRangeInt() {
		return rangeInt;
	}

	public void setRangeInt(int rangeInt) {
		this.rangeInt = rangeInt;
	}
	
	public void setRange(List<GridCoordinate> range){
		this.range = range;
	}
	public List<GridCoordinate> getRange(){
		return this.range;
	}
	
	public String getAmmoImageName() {
		return ammoImageName;
	}

	public void setAmmoImageName(String ammoImageName) {
		this.ammoImageName = ammoImageName;
	}

	public void hit(Zombosaur zombo, int angle){
		if (this instanceof SlowingCanon){
			System.out.println("Current Speed" + zombo.getCurrentSpeed());
			zombo.slow(damage);
		}
		else{
			zombo.hit(damage,angle);
		}
	}
	/**
	 * Creates the range depending on the type of weapon.
	 */
	public abstract void createRange();
	
}
